#ifndef STUDENT_H
#define STUDENT_H

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "course.h"

typedef char *CourseIDArray[150]; // 假设最多有100个课程

typedef struct Student
{
    char id[20];
    char name[50];
    Course *courses;
    int total_credits;
    struct Student *next;
} Student;

// Function prototypes
void add_student(Student **head, const char *id, const char *name, const Course *course_head, const CourseIDArray course_ids, int num_courses, int is_file);
void delete_student(Student **head, const char *id);
void update_student(Student **head, const char *id);
void find_student(const Student *head, const char *id);
void list_students(const Student *head);
int contains_student(const Student *head, const char *id);
Student *get_student(Student **head, const char *id);
const Student *get_const_student(const Student *head, const char *id); // const 版本函数
void load_students_from_file(Student **head, const char *filename, const Course *course_head);
void save_students_to_file(const Student *head, const char *filename);
void log_action(const char *action, const char *details);


#endif // STUDENT_H
